package my.edu.constant;

import lombok.Data;
import my.edu.common.constant.MessageConstant;
import my.edu.common.exception.BillsException;
import my.edu.common.exception.Order.PurchaseException;
import my.edu.model.bills.purchase.entity.dto.PurchaseDTO;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Data
@ConfigurationProperties(prefix = "customer.data") // 配置文件的前缀
@Component
public class DeliveryMethod {
    private List<String> deliveryMethod;

    public void checkDeliveryMethod(String dtoDeliveryMethod) {
        if (dtoDeliveryMethod != null && !dtoDeliveryMethod.isEmpty()
                && !getDeliveryMethod().contains(dtoDeliveryMethod))
            throw new BillsException(MessageConstant.CAN_NOT_FOUND_DeliveryMethod);
    }

}
